package main


import (
	"fmt"
	"sync"
	"time"
)

const (
	websocketWriteDeadLine = 10 * time.Second
)

func main()  {

	var mutex sync.Mutex
	fmt.Println("Lock then mutex")
	mutex.Lock()

	go func(){
		mutex.Lock()
		fmt.Println("groutine print")
		mutex.Unlock()
	}()
	time.Sleep(3 * time.Second)
	fmt.Println("main Unlock mutex")
	mutex.Unlock()
	time.Sleep(3 * time.Second)
	//同一协程没有Unlock连续 调用2次Lock会死锁报错
	fmt.Println("main end")
}